--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
docs/agents/conventions/tests.md dev (af76f09d) Text, 3.78 KB
Test conventions
Applies when editing T383838tests/**/*.{py,js}.
• Backend: T383838tests/backend/test_*.py with pytest + asyncio auto mode.
• Frontend: T383838tests/frontend/*.test.js with vitest + T383838@vue/test-utils.
• Mock T383838window.api for page tests. Assert toasts when outcomes are user-visible.
• Prefer focused files over full suite unless the user asks for broad runs.
• Landlock tests that apply the sandbox must run in a subprocess (one restrict per process).
• Shared runner: T383838tests/backend/landlock_integration_support.py (T383838run_python_under_landlock).
• Subprocess and user-local CLI probes: T383838tests/backend/test_landlock_integration_surfaces.py.
• Unit tests for rules and ABI: T383838tests/backend/test_landlock_sandbox.py.
• Long-running / notification soak suites can hang. Prefer timeouts and avoid piping pytest through T383838tail in agent shells.
Oracle style (no soft fuzz)
Property and fuzz tests must assert an accept or reject outcome, not only that nothing crashed.
Refuse bare T383838except Exception: pass, T383838never_raises-only tests, checking a result dict has an T383838"ok" key without checking its value, and mocks that always succeed under a security oracle.
Prefer an independent oracle (predict accept or reject from the input, then assert the code matches), jail oracles (resolved path stays under the allowed root), closed reason sets (T383838ValueError message is one of the known machine reasons), or round-trip invariants for pure parsing.
Full guidance and examples: T383838docs/agents/skills/test-oracles/SKILL.md.
Path jail filesystem features: T383838docs/agents/skills/path-jail-local-fs/SKILL.md and T383838docs/agents/conventions/path-jail.md.
Exploratory bug hunting: T383838docs/agents/skills/exploratory-testing/SKILL.md.
Frontend mega-page ownership contracts
• Ownership inventory: T383838tests/frontend/fixtures/frontend_mega_page_ownership.json
• Symbol continuity: T383838tests/frontend/fixtures/frontend_symbol_continuity/
• Scanner tests: T383838tests/frontend/frontendOwnershipContract.test.js
• Extract workflow: T383838docs/agents/skills/vue-mega-page-split/SKILL.md
• Refresh ownership fixture only when inventory intentionally changes:
T383838UPDATE_FRONTEND_OWNERSHIP=1 pnpm exec vitest run tests/frontend/frontendOwnershipContract.test.js -t ownership_fixture
HTTP and WS path-scanning contracts
Route and WS manifests are discovered from source text:
• HTTP: T383838tests/backend/http_api_contract_helpers.py scans T383838meshchatx/meshchat.py and T383838meshchatx/src/backend/http/**/*.py
• WS: T383838tests/backend/ws_contract_helpers.py scans the same trees plus T383838rns_link_manager.py for link events
Fixtures:
• T383838tests/backend/fixtures/http_api_routes.json
• T383838tests/backend/fixtures/ws_message_manifest.json
Refresh only when the inventory intentionally changes:
T282828
Te6edf3UPDATE_HTTP_API_ROUTESTff7b72=T79c0ff1 uv run pytest tests/backend/test_http_api_contract.py -k meshchat_http_routes_match_fixture
Te6edf3UPDATE_WS_MESSAGE_MANIFESTTff7b72=T79c0ff1 uv run pytest tests/backend/test_ws_json_contracts.py -k manifest_matches_meshchat
JSON response schemas stay in T383838tests/backend/ (T383838api_json_contract_schemas.py, T383838http_api_response_schemas.py, registry files). Domain ownership for routes vs schemas: T383838docs/agents/module-ownership.md. Extraction workflow: T383838docs/agents/skills/meshchat-orchestration-split/SKILL.md.
Extended Edge Case Tester (EECT) and Live Validation (LV)
• EECT packs live under T383838tests/backend/eect/packs/ and use marker T383838eect.
• LV ladder lives under T383838tests/backend/eect/live/ and uses marker T383838live_validation.
• Replay a failure with T383838MESHCHAT_EECT_SEED=<seed> (printed on assert failure).
• Commands: T383838task test:eect, T383838task test:lv:l0, T383838MESHCHAT_LIVE_VALIDATION=1 task test:lv.
• LV L2/L3 are opt-in (T383838MESHCHAT_LIVE_VALIDATION=1 or T383838MESHCHAT_LIVE_RETICULUM=1). L0/L1 stay CI-safe.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────